// Point.java
// by Alexandre Martins, 2013
// MAC 5857 - Prof. Leonidas

package example.ilm.model;

import java.awt.geom.Point2D;
import java.awt.geom.Point2D.Double;

public class Point extends GeometricElement {

    public Point() {
        super("point");
        vertices.add(new Point2D.Double(0.0, 0.0));
    }

    public boolean contains(Point2D p) {
        Point2D vertex = (Point2D)vertices.get(0);
        return vertex.equals(p);
    }

    public String toString() {
        return "" + 
            "<point>" + 
                "<name>" + getName() + "</name>" + 
                "<description>" + getDescription() + "</description>" + 
                "<position>" +
                    positionToString() +
                "</position>" + 
                "<vertices>" +
                    verticesToString() +
                "</vertices>" +
            "</point>" +
        "";
    }
}
